// Learn TypeScript:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html

import Character from "../../BASE/Character";
import state from "../../game/time/state";
import GeZiManager from "../../Manager/GeZiManager";
import { Message } from "../../Message/Message";
import MessageCenter from "../../Message/MessageCenter";
import CXX from "./CXX";

const {ccclass, property} = cc._decorator;

  @ccclass
export default class C12 extends CXX {

    target:Character=null;
    TheNumber:string = 'C12';
        Cname:string="云丸"
      fWwalkWay: number=1;
    start () {
      this.target=this.node.getComponent(Character);
        this.fWwalkWay=this.target.walkWay;
        this.target.walkWay=0;
        this.target.MwalkWay=0
       this.target.Mjia(-1)
        this.target.walk2.push(this);
        this.target.walk1.push(this);
        }
    
    Walk1(): void {
        if (this.target.PPC()) {
        GeZiManager.qing();
        MessageCenter.MakeMessage("UIManager", "change", -1);
       state.ST=1;
        let q=this.target.qi
        GeZiManager.GeZi=this.target.ZB
        for(let manager of GeZiManager.YuanGong){
  
            manager.getFarIN(q);
          if(this.faceSide(this.target.faceTo).includes(this.target.faceIs(this.target.ZB))){
               manager.out()}
              
          }
          let c=new Message("",GeZiManager.GeZis,1);
          for(let manager of GeZiManager.YuanGong){
          
          
           manager.getFar(this.target.qi+1)
          }
        }
    
    }    




    Walk2(ZB: number): void {
     if (this.target.PPC()) {
        let k=this.target.getdis(ZB)
        MessageCenter.MakeSHMessage("AM",[this.target.ZB],k,this.target.Pturn,"Qi-");
        MessageCenter.MakeSHMessage("AM",[GeZiManager.PCP.ZB],GeZiManager.TNC[1]+this.target.TNJJ[1],this.target.Pturn,"TN-");  
     }
       
    }
    
    
    remove(){
        GeZiManager.shanchu(this.target.walk1,this)
        GeZiManager.shanchu(this.target.walk2,this)
        this.target.MwalkWay=this.fWwalkWay;
        this.target.walkWay=this.fWwalkWay;
    }

    
    }
